package com.jiawa.train.batch.feign;

import com.jiawa.train.common.resp.CommonResp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Date;

// @FeignClient(name = "business", url = "http://127.0.0.1:8002/business")
@FeignClient(value = "business", fallback = BusinessFeignFallback.class)
public interface BusinessFeign {

    @GetMapping("/business/hello")
    String hello();

    /**
     * 使用OpenFeign的时候,如果参数中带有@PathVariable形式的参数,则要用value=""标明对应的参数,
     *   否则会抛出IllegalStateException异常（就是找不到指定的参数）
     */
    @GetMapping("/business/admin/daily-train/gen-daily/{date}")
    CommonResp<Object> genDaily(@PathVariable(value = "date") @DateTimeFormat(pattern = "yyyy-MM-dd") Date date);
}
